package com.shuaiche.yeguan.model;


import com.shuaiche.yeguan.util.StringUtils;

import java.util.List;

/**
 * 经销商用户登录 个人信息model
 */
public class SCUserInfoResponse extends BaseResponseModel<SCUserInfoResponse> {
    private String sessionId;   //会话id
    private Long userId;        //用户id
    private String username;    //用户名（通常为手机号）
    private String phone;
    private String fullname;    //姓名
    private String nick;        //昵称
    private String face;        //头像
    private String email;       //邮箱
    private Integer gender;         //性别 1：女，2：男
    private String birthdate;   //生日
    private boolean pwdModified;    //密码是否改过
    private Integer userType;       //用户类型 1：经销商，2：车源商
    private Integer status;         //用户状态
    private String merchantName;    //商户名称
    private String merchantAbbreviation;    //商户简称
    private Integer merchantStatus; //商户状态 状态 null:未填写, 0:公司注册, 1:审核通过,2:审核不通过,3:冻结， 4:审核中
    private Long merchantId;     //商户id
    private String merchantLogoPic; //
    private String job;         //岗位
    private String address;
    private int memberClass;// 会员等级，10普通 20联盟会员 30诚信会员 40严选会员
    private Long expireTime; // 服务端计算的时间差值 若小于0则表示会员已过期

    private String imToken;//即时通讯token
    private String imUserId;//即时通讯用户ID
    private int imTokenExpireTimeSeconds;//IMtoken 的过期时间（单位秒）

    private int isFranchisee = 0;

    public int getIsFranchisee() {
        return isFranchisee;
    }

    public void setIsFranchisee(int isFranchisee) {
        this.isFranchisee = isFranchisee;
    }

    public Long getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(Long expireTime) {
        this.expireTime = expireTime;
    }

    public int getMemberClass() {
        return memberClass;
    }

    public void setMemberClass(int memberClass) {
        this.memberClass = memberClass;
    }

    public String getImToken() {
        return imToken;
    }

    public void setImToken(String imToken) {
        this.imToken = imToken;
    }

    public String getImUserId() {
        return imUserId;
    }

    public void setImUserId(String imUserId) {
        this.imUserId = imUserId;
    }

    public int getImTokenExpireTimeSeconds() {
        return imTokenExpireTimeSeconds;
    }

    public void setImTokenExpireTimeSeconds(int imTokenExpireTimeSeconds) {
        this.imTokenExpireTimeSeconds = imTokenExpireTimeSeconds;
    }

    /**
     * 如果 scUnions 为空  则未加入联盟
     */
    private List<SCUnionModel> scUnions;    //联盟id

    /**
     * 经纪人身份加入的联盟
     */
    private List<SCUnionModel> brokerUnions;


    /**
     * 权限值
     */
    private String perms;

    /**
     * 职务
     */
    private String roleName;

    /**
     * 经纪人标识
     * 0：否   1：是
     */
    private Integer isMerchantBroker; // 平台经纪人
    private Integer isUserBroker;

    /**
     * 是否加入官方联盟标志
     * 0：否   1：是
     */
    private Integer isOfficialMember;


    private Integer brokerType;        //1：个人  2：企业
    private Integer brokerAuditStatus; //0：未审核； 1：待审核； 2：审核通过；3：审核失败；4：冻结
    private Integer brokerChannel;      //渠道 1：官方渠道   2：自主加入  3：经销商推荐
    private Long brokerInviter;         //邀请人商户id  即表示是商户挂靠经纪人

    /**
     * 二级经纪人 1  不可看到信息
     */
    private Integer isQuarantine;   //是否隔离

    /**
     * 是否品牌门店
     */
    private Integer isScBrand;      // 0否1是

    // 经纪人能否查看联盟价格 1可以 0不可以(如果不是经纪人，该属性为空)
    private Integer unionPricePermission;

    public Integer getUnionType() {
        return unionType;
    }

    public void setUnionType(Integer unionType) {
        this.unionType = unionType;
    }

    // 联盟类型 1普通 2会员
    private Integer unionType;


    private int accountStatus;//商户状态1:正常,2冻结

    public int getAccountStatus() {
        return accountStatus;
    }

    public void setAccountStatus(int accountStatus) {
        this.accountStatus = accountStatus;
    }


    public Integer getUnionPricePermission() {
        return unionPricePermission;
    }

    public void setUnionPricePermission(Integer unionPricePermission) {
        this.unionPricePermission = unionPricePermission;
    }

    public String getSessionId() {
        return sessionId;
    }

    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getFullname() {
        return fullname;
    }

    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    public String getNick() {
        return nick;
    }

    public void setNick(String nick) {
        this.nick = nick;
    }

    public String getFace() {
        return face;
    }

    public void setFace(String face) {
        this.face = face;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public String getBirthdate() {
        return birthdate;
    }

    public void setBirthdate(String birthdate) {
        this.birthdate = birthdate;
    }

    public boolean isPwdModified() {
        return pwdModified;
    }

    public void setPwdModified(boolean pwdModified) {
        this.pwdModified = pwdModified;
    }

    public Integer getUserType() {
        return userType;
    }

    public void setUserType(Integer userType) {
        this.userType = userType;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMerchantName() {
        if (StringUtils.isEmpty(merchantAbbreviation)) {
            return merchantName;
        } else {
            return merchantAbbreviation;
        }
    }

    /**
     * 返回全称
     */
    public String getFullMerchantName() {
        return merchantName;
    }

    public void setMerchantName(String merchantName) {
        this.merchantName = merchantName;
    }

    public Integer getMerchantStatus() {
        return merchantStatus;
    }

    public void setMerchantStatus(Integer merchantStatus) {
        this.merchantStatus = merchantStatus;
    }

    public Long getMerchantId() {
        return merchantId;
    }

    public void setMerchantId(Long merchantId) {
        this.merchantId = merchantId;
    }

    public String getJob() {
        return job;
    }

    public void setJob(String job) {
        this.job = job;
    }

    public String getMerchantLogoPic() {
        return merchantLogoPic;
    }

    public void setMerchantLogoPic(String merchantLogoPic) {
        this.merchantLogoPic = merchantLogoPic;
    }


    public List<SCUnionModel> getScUnions() {
        return scUnions;
    }

    public void setScUnions(List<SCUnionModel> scUnions) {
        this.scUnions = scUnions;
    }

    public String getPerms() {
        return perms;
    }

    public void setPerms(String perms) {
        this.perms = perms;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public String getMerchantAbbreviation() {
        return merchantAbbreviation;
    }

    public void setMerchantAbbreviation(String merchantAbbreviation) {
        this.merchantAbbreviation = merchantAbbreviation;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Integer getIsMerchantBroker() {
        return isMerchantBroker;
    }

    public void setIsMerchantBroker(Integer isMerchantBroker) {
        this.isMerchantBroker = isMerchantBroker;
    }

    public Integer getIsUserBroker() {
        return isUserBroker;
    }

    public void setIsUserBroker(Integer isUserBroker) {
        this.isUserBroker = isUserBroker;
    }

    public List<SCUnionModel> getBrokerUnions() {
        return brokerUnions;
    }

    public void setBrokerUnions(List<SCUnionModel> brokerUnions) {
        this.brokerUnions = brokerUnions;
    }

    public Integer getIsOfficialMember() {
        return isOfficialMember;
    }

    public void setIsOfficialMember(Integer isOfficialMember) {
        this.isOfficialMember = isOfficialMember;
    }

    public Integer getBrokerType() {
        return brokerType;
    }

    public void setBrokerType(Integer brokerType) {
        this.brokerType = brokerType;
    }

    public Integer getBrokerAuditStatus() {
        return brokerAuditStatus;
    }

    public void setBrokerAuditStatus(Integer brokerAuditStatus) {
        this.brokerAuditStatus = brokerAuditStatus;
    }

    public Integer getBrokerChannel() {
        return brokerChannel;
    }

    public void setBrokerChannel(Integer brokerChannel) {
        this.brokerChannel = brokerChannel;
    }

    public Long getBrokerInviter() {
        return brokerInviter;
    }

    public void setBrokerInviter(Long brokerInviter) {
        this.brokerInviter = brokerInviter;
    }

    public Integer getIsQuarantine() {
        return isQuarantine;
    }

    public void setIsQuarantine(Integer isQuarantine) {
        this.isQuarantine = isQuarantine;
    }

    public Integer getIsScBrand() {
        return isScBrand;
    }

    public void setIsScBrand(Integer isScBrand) {
        this.isScBrand = isScBrand;
    }

    /**
     * @param isQuarantine
     * @return
     * 经纪人被隔离情况下 挂靠商户的经销商name
     */
    public String getBrokerInviterMerchantName(Integer isQuarantine){
        if (isQuarantine != null && isQuarantine == 1) {
            if (!StringUtils.isEmpty(getMerchantAbbreviation())) {
                return getMerchantAbbreviation();
            } else {
                return getMerchantName();
            }
        } else {
            return "";
        }
    }
}
